<template>
	<view class="">
		<u-swiper :list="info.images" height="500" img-mode="widthFix" indicator-pos="bottomRight"></u-swiper>


		<view class="u-padding-20">
			<view class="title u-line-2">{{info.goodsName}}</view>
			<view class="u-flex  u-row-between u-margin-top-10">
				<view class="u-flex">
					<view class="price">{{info.price}}积分</view>			
				</view>			
			</view>
		</view>

		<u-gap height="10" bg-color="#f1f1f1"></u-gap>


		<u-cell-group>
			<u-cell-item title="商品原价" :value="'￥'+info.price" :arrow="false"></u-cell-item>
			<u-cell-item title="商品运费" :value="'￥'+info.expressFee" :arrow="false"></u-cell-item>
			<u-cell-item title="商品库存" :value="'仅剩'+info.sku+'件'" :arrow="false"></u-cell-item>
		</u-cell-group>

		<u-gap height="10" bg-color="#f1f1f1"></u-gap>


		<view class="">
			<view style="margin:40rpx auto 40rpx auto;width: 140rpx;">

				<u-image src="/static/detailtitle.png" width="140" height="60"></u-image>

			</view>

		      <u-parse :html="info.detail"></u-parse>
		</view>



		<view class="navigation" @click="change">
			立即兑换
		</view>


	


	</view>
</template>

<script>
	

	export default {
	
		data() {
			return {
				id:"",
				info: {	     
					images: [],
				},
			
			}
		},
		methods: {
			addCar() {
			
				this.$refs.chilren.show = true
			}
		},
		onLoad(options){
			if(options.id){
				this.id=options.id
			}
			this.get()
		},
		methods:{
			get(){
			
				this.$u.post('/api/index/goodsDetail', {
				    goods_id:this.id,				
				   
				}, {}).then(res => {
				     // var {goodsName,price,expressFee,images,sku.detail}=res.data;
					 this.info=res.data;
				}).catch(err => {})
			},
			change(){		
				this.$u.post('/api/indent/affirm', {
					goods_id: this.id,
					num: 1,
				}, {}).then(res => {
					uni.navigateTo({
						url: "../../pages/sure_book/index?num=1"+'&id='+this.id +'&ptt=1' + '&isjifen=1'
					})
				}).catch(err => {})			
			
			}
		
		}
	}
</script>

<style scoped lang="scss">
	.share {
		background: #628DFF;
		border-radius: 30rpx;
		width: 140rpx;
		height: 60rpx;
		line-height: 60rpx;
		text-align: center;
		color: #FFFFFF;
		position: relative;

		button {
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			opacity: 0;
		}
	}

	.title {
		color: #333;
		font-size: 36rpx;
	}

	.price {
		color: #FF6450;
		font-size: 56rpx;
	}

	.oldprice {
		text-decoration: line-through;
		color: #999999;
		font-size: 28rpx;
		margin-left: 20rpx;
	}



	.navigation {
	
		background-color: #628DFF;
		padding: 30rpx 0;
		position: fixed;
		bottom: 0;
		width: 100%;
		left:0;
		color:#FFFFFF;
		font-size: 40rpx;
		text-align: center;
		


	}
</style>
